from rest_framework import serializers
from .models import User

class UserSerializer(serializers.ModelSerializer):
    """
    用户信息序列化器：用于用户信息的序列化与反序列化
    """
    class Meta:
        model = User
        fields = [
            'id', 'username', 'phone', 'email', 'avatar',
            'last_login_time', 'status', 'created_at', 'updated_at'
        ]
        read_only_fields = ['id', 'created_at', 'updated_at', 'last_login_time'] 